$(document).ready(function(){
	/**
	 * 充值
	 * @returns
	 */
	var payMoneyInit = function(){
		$("#optionList>span").click(function(){
			$('#payMoney').val($(this).attr("lang"));
			$("div[id='optionList']>span[class='ui_btn focus']").attr('class', 'ui_btn');
			$(this).attr('class', 'ui_btn focus');
		});	
		
		$("#optionText").click(function(){
			$("#optionList div,span[class='ui_btn focus']").attr('class', 'ui_btn');
		});
		
		$("#optionText").blur(function(){
			var payMoney = $('#optionText').val();
			if('' == payMoney)
			{
				$("div[id='optionList']>span[class='ui_btn focus']").attr('class', 'ui_btn');
				$("div[id='optionList']>span[lang='10']").attr('class', 'ui_btn focus');
			}
			else
			{
				$('#payMoney').val(payMoney);
			}
		});
		
		$("#submitPayFormButton").click(function(){
			Helper.message("抱歉！接合作福利彩票发行中心通知，暂停部分服务功能，恢复时间将另行通知！");
			return false;
			var payMoney = $('#payMoney').val();
			var optionText = $('#optionText').val();
			var providerId = $('#providerId').val();
			var reg=/^[1-9]{1}\d*(\.\d{1,2})?$/;
			if('' != optionText)
			{
				if (reg.test(optionText)) {
					if (parseFloat(optionText) < 10) {
						Helper.message("充值金额最低10元");
						return false;
					}
					else if(parseFloat(optionText) > 1000000)
					{
						Helper.message("充值金额最高1000000元");
						return false;
					}
				} 
				else 
				{
					Helper.message("充值金额最低10元!");
					return false;
				}
			}
			else
			{
				if (reg.test(payMoney)) {
					if (parseFloat(payMoney) < 10) {
						Helper.message("充值金额最低10元");
						return false;
					}
					else if(parseFloat(payMoney) > 1000000)
					{
						Helper.message("充值金额最高1000000元");
						return false;
					}
				} 
				else 
				{
					Helper.message("充值金额最低10元!");
					return false;
				}
			}
			
			if('' == providerId)
			{
				Helper.message("请选择充值方式!");
				return false;
			}
			new Helper.RemoteQuery({
					url:Helper.basePath + "/member_operate/payment/pay_ok.htm",
					params:{payMoney: payMoney, providerId: providerId,payName:$("#payName_"+providerId).val()},
					renderId:"payDiv",
					onSuccess:function(){
						payConfirmInit();
					}
				}).send();
			window["payment"]={};
			window["payment"]["paysubmit"]=payForm;
		});
	};
	payMoneyInit();
	
	var payConfirmInit = function(){
		var payMoney = $('#payMoney').val();
		var providerId = $('#providerId').val();
		$("#userPayFormSubmit").click(function (){
			new Helper.RemoteQuery({
				url:Helper.basePath + "/member_login_operate/payRequest.htm",
				params:{payMoney: payMoney, providerId: providerId},
				renderId:"payDiv",
				onSuccess:function(){
					
				}
			}).send();
		});
	};
	
});